package com.itheima.servlet;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;


        /**
         * 问题:
         *      为了使用一个service方法,不得不重写servlet接口中的所有方法,非常麻烦
         * 解决方案:
         *      找一个中间类,让它实现Servlet接口,重写其他的四个方法,我们的类直接继承中间类即可
         */
@WebServlet(urlPatterns = "/demo2")
public class Demo2Servlet extends GenericServlet {
    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("Demo2Servlet方法执行了");
        servletResponse.getWriter().println("success");
    }
}
